<?php

namespace App\Http\Requests\Api\v2;

use App\Http\Requests\CommonRequest;

class InvoiceRequest extends CommonRequest
{
    public $scenes = [
        'index' => 'restaurant_id',
        'store' => 'type,price,name,restaurant_id',
    ];

    public function rules()
    {
        return [
            'type'          => ['required', 'numeric'],
            'price'         => ['required', 'numeric', 'min:0.1'],
            'name'          => ['required'],
            'restaurant_id' => ['required'],
        ];
    }

    public function messages()
    {
        return [
            'type.required'          => "类型不能为空",
            'type.numeric'           => "类型必须是数字",
            'price.required'         => "金额不能为空",
            'price.numeric'          => "金额必须是数字",
            'price.min'              => "金额不能小于0.1元",
            'name.required'          => "抬头名称不能为空",
            'restaurant_id.required' => "餐厅ID不能为空",
        ];
    }

}
